package com.mall;

import java.util.Date;

import com.mall.util.DateUtil;

public class Coupons extends AbstractDiscount implements Comparable<Coupons>{

	private GoodsCategory category;
	private double threshold;
	private double discountValue;
	private boolean isUsed = false;;
	
	
	
	public Coupons(String beginStr,String endStr, double threshold,
			double discountValue) {
		super();
		this.threshold = threshold;
		this.discountValue = discountValue;
		this.isUsed = false;
		this.begin = DateUtil.formatStrToDate(beginStr, DateUtil.DATE_FORMAT_SHORT);
		this.end = DateUtil.formatStrToDate(endStr, DateUtil.DATE_FORMAT_SHORT);
	}
	public GoodsCategory getCategory() {
		return category;
	}
	public void setCategory(GoodsCategory category) {
		this.category = category;
	}
	public double getThreshold() {
		return threshold;
	}
	public void setThreshold(double threshold) {
		this.threshold = threshold;
	}
	public double getDiscountValue() {
		return discountValue;
	}
	public void setDiscountValue(double discountValue) {
		this.discountValue = discountValue;
	}
	
	
	@Override
	public int compareTo(Coupons o) {
		if(this.getDiscountValue()>o.getDiscountValue()){
			return 1;
		}else{
			return -1;
		}
	}
	
	
}
